var g, _extends = Object.assign || function (t) {
  for (var e = 1; e < arguments.length; e++) {
    var a, r = arguments[e];
    for (a in r) Object.prototype.hasOwnProperty.call(r, a) && (t[a] = r[a]);
  }
  return t;
},
_tools = require("../../utils/tools"),
app = getApp(),
page = app.page,
request = app.util.request,
route = app.route,
toast = app.toast;
page({
data: {
  useInfo: "",
  typeList: [{
      name: "全部",
      value: ''
    },
    {
      name: "钻石获取",
      value: "+"
    },
    {
      name: "钻石消耗",
      value: "-"
    }
  ],
  currentType: 0,
  no_data: app.srcRoot + "no_data.png",
  list: []
},
onLoad: function (t) {
  g = this;
  let userInfo = wx.getStorageSync("userInfo")
  if (userInfo) {
    request({
      url: "AddUsersLog",
      data: {
        user_id: userInfo.id,
        url: '/fenxiao/goods/log',
        title: "积分详情"
      },
      success: function (a) {}
    })
    request({
      url: "Openid",
      showLoading: !1,
      data: {
        user_id: g.data.userInfo.id
      },
      success: function (t) {
        wx.setStorageSync("userInfo", t)
        g.setData({
          userInfo: t
        })
      }
    })
  }
  g.getInfo()
},
onReady: function () {
  var t = wx.getSystemInfoSync().screenWidth,
    e = .04 * t,
    t = (e * e + t * t / 4) / (2 * e);
  g.setData({
    style: "background: radial-gradient(circle at 50% " + (e - t) + "px, " + wx.getStorageSync("system").foot_color2 + " " + t + "px, rgba(0,0,0,0) " + t / 2 + "px);"
  }), (0, _tools.getNodeInfo)({
    id: "#top",
    success: function (t) {
      // return g.setData({
      //   top: t.bottom
      // });
    }
  });
},
onShow: function () {

},
onPullDownRefresh: function () {

},
toPage: function(t) {
  var url = t.currentTarget.dataset.url;
  wx.navigateTo({
    url
  })
},
getInfo: function () {
  request({
    url: "ScoreLog",
    showLoading: !1,
    data: {
      user_id: g.data.userInfo.id,
      type: g.data.typeList[g.data.currentType].value
    },
    success: function (t) {
      g.setData({
          list: t
      })
    }
  })
},
navChange: function (t) {
  var index = t.currentTarget.dataset.index;
  g.setData({
    currentType: index
  })
  g.getInfo()
}
});